package de.koller.worlders.gameplay.resource;

import de.koller.oceanFramework.OceanException;
import de.koller.oceanFramework.glyph.IFontValue;

public class FontValue implements IFontValue {

	public FontValue() {}
	
	@Override
	public int[] getGlyphP( String c ) {
		if( " ".equals( c ) ) return new int[] { -1, -1 };
		
		char f = c.charAt( 0 );
		int d = (int)f - (int)'0';
		if( d < 10 && d >= 0 ) return new int[] { d, 0 };
		
		d = (int)f - (int)'A';
		if( d < 26 && d >= 0 ) return new int[] { d, 1 };
		
		d = (int)f - (int)'a';
		if( d < 26 && d >= 0 ) return new int[] { d, 2 };
		
		if( "!".equals( c ) ) return new int[] { 0, 3 };
		if( ".".equals( c ) ) return new int[] { 1, 3 };
		if( "\"".equals( c ) ) return new int[] { 2, 3 };
		if( "§".equals( c ) ) return new int[] { 3, 3 };
		if( "$".equals( c ) ) return new int[] { 4, 3 };
		if( "%".equals( c ) ) return new int[] { 5, 3 };
		if( "&".equals( c ) ) return new int[] { 6, 3 };
		if( "/".equals( c ) ) return new int[] { 7, 3 };
		if( "(".equals( c ) ) return new int[] { 8, 3 };
		if( ")".equals( c ) ) return new int[] { 9, 3 };
		if( "=".equals( c ) ) return new int[] { 10, 3 };
		if( "?".equals( c ) ) return new int[] { 11, 3 };
		if( "@".equals( c ) ) return new int[] { 12, 3 };
		if( ">".equals( c ) ) return new int[] { 13, 3 };
		if( "<".equals( c ) ) return new int[] { 14, 3 };
		if( "|".equals( c ) ) return new int[] { 15, 3 };
		if( "^".equals( c ) ) return new int[] { 16, 3 };
		if( "°".equals( c ) ) return new int[] { 17, 3 };
		if( "\\".equals( c ) ) return new int[] { 18, 3 };
		if( "[".equals( c ) ) return new int[] { 19, 3 };
		if( "]".equals( c ) ) return new int[] { 20, 3 };
		if( "{".equals( c ) ) return new int[] { 21, 3 };
		if( "}".equals( c ) ) return new int[] { 22, 3 };
		if( "²".equals( c ) ) return new int[] { 23, 3 };
		if( "³".equals( c ) ) return new int[] { 24, 3 };
		if( "-".equals( c ) ) return new int[] { 25, 3 };
		
		if( "`".equals( c ) ) return new int[] { 14, 4 };
		if( "´".equals( c ) ) return new int[] { 15, 4 };
		if( "'".equals( c ) ) return new int[] { 16, 4 };
		if( "#".equals( c ) ) return new int[] { 17, 4 };
		if( "~".equals( c ) ) return new int[] { 18, 4 };
		if( "*".equals( c ) ) return new int[] { 19, 4 };
		if( "+".equals( c ) ) return new int[] { 20, 4 };
		if( ".".equals( c ) ) return new int[] { 21, 4 };
		if( ",".equals( c ) ) return new int[] { 22, 4 };
		if( ";".equals( c ) ) return new int[] { 23, 4 };
		if( ":".equals( c ) ) return new int[] { 24, 4 };
		if( "_".equals( c ) ) return new int[] { 25, 4 };

		if( "ß".equals( c ) ) return new int[] { 14, 5 };
		if( "Ä".equals( c ) ) return new int[] { 15, 5 };
		if( "Ö".equals( c ) ) return new int[] { 16, 5 };
		if( "Ü".equals( c ) ) return new int[] { 17, 5 };
		if( "ä".equals( c ) ) return new int[] { 18, 5 };
		if( "ö".equals( c ) ) return new int[] { 19, 5 };
		if( "ü".equals( c ) ) return new int[] { 20, 5 };
		
		int z = (int)c.charAt( 0 );
		if( z == 0x1b ) return new int[] { 10, 5 };
		if( z == 0xa ) return new int[] { 11, 5 };
		if( z == 0x8 ) return new int[] { 12, 5 };
		
		throw new OceanException( "unknown symbol: " + c + "(0x" + Integer.toHexString( (int)c.charAt( 0 ) ) + ")" );
	}
	
}
